package com.xjn.updatetool.util;

/**
 * @author lilin
 * @create 2020-07-29 15:41
 **/
public class MyStringUtils {
    /**
     * 前面补0至指定的长度
     * @param toLen
     * @param code
     * @return
     */
    public static String getCodeByLength(int toLen,String code){
        if(toLen<=code.length()){
            return code;
        }
        StringBuffer stringBuffer = new StringBuffer();
        for(int p=0;p<toLen-code.length();p++){
            stringBuffer.append("0");
        }
        return stringBuffer.append(code).toString();
    }
}
